<div class="page-content" >
	<div class="panel panel-default">
		<div class="panel-heading">
			<ul class="breadcrumb">
				<li><a  href="<{:addons_url('fields',array('group_name'=>$group_name))}>">字段列表</a> </li>
				<li class="active">添加字段</li>
			</ul>
		</div>
		<div class="panel-body">
			<form id="myform" method="post" class="form-horizontal" action="<{:addons_url('add')}>">
				<input type="hidden" name="id" value="<{$data.id}>">
				<if condition="$group_name">
				<input type="hidden" name="group_name" value="<{$group_name}>">
				<else/>
				<div class="form-group">
					<label for="input-title"  class="col-sm-2 control-label">字段组名</label>
					<div class="col-sm-7">
						<input  type="text" class="form-control"  id="group_name" name="group_name" value="<{$data.group_name}>">
					</div>
				</div>
				</if>
				<div class="form-group">
					<label for="input-title"  class="col-sm-2 control-label">字段名(数据库)</label>
					<div class="col-sm-7">
						<input  type="text" class="form-control"  id="fieldName" name="fieldName" value="<{$data.fieldName}>">
					</div>
				</div>
				<div class="form-group">
					<label for="input-title"  class="col-sm-2 control-label">显示名</label>
					<div class="col-sm-7">
						<input  type="text" class="form-control"  id="fieldDisplay" name="fieldDisplay" value="<{$data.fieldDisplay}>">
					</div>
				</div>
				<div class="form-group">
					<label for="input-title"  class="col-sm-2 control-label">字段描述</label>
					<div class="col-sm-7">
						<input  type="text" class="form-control"  id="fieldDes" name="fieldDes" value="<{$data.fieldDes}>">
					</div>
				</div>
				<div class="form-group">
					<label for="input-title"  class="col-sm-2 control-label">是否必填</label>
					<div class="col-sm-7"> <{:form_select('IsNeed',array('1'=>'是','2'=>'否'),$data['IsNeed'])}> </div>
				</div>
				
						<div class="form-group">
					<label for="input-title"  class="col-sm-2 control-label">只读文本框</label>
					<div class="col-sm-7"> <{:form_select('readonly',array('1'=>'是','2'=>'否'),$data['readonly'])}> </div>
				</div>
				
				<div class="form-group">
					<label for="input-title"  class="col-sm-2 control-label">默认值</label>
					<div class="col-sm-7">
						<input  type="text"   class="form-control"  id="defaultValue" name="defaultValue" value="<{$data.defaultValue}>">
					</div>
				</div>
				<div class="form-group">
					<label for="input-title"  class="col-sm-2 control-label">字段长度</label>
					<div class="col-sm-7">
						<input  type="text" class="form-control"  id="fieldLen" name="fieldLen" value="<{$data.fieldLen}>">
					</div>
				</div>
				<div class="form-group">
					<label for="input-title"  class="col-sm-2 control-label">单位</label>
					<div class="col-sm-7">
						<input  type="text" class="form-control"  id="unit" name="unit" value="<{$data.unit}>">
					</div>
				</div>
				<div class="form-group">
					<label for="input-title"  class="col-sm-2 control-label">排序</label>
					<div class="col-sm-7">
						<input  type="text" class="form-control"  id="order_by" name="order_by" value="<{$data['order_by']?$data['order_by']:999}>">
					</div>
				</div>
				<div class="form-group">
					<label for="input-title"  class="col-sm-2 control-label">字段前缀<>+-</label>
					<div class="col-sm-7">
						<input  type="text" class="form-control"  id="fieldPrefix" name="fieldPrefix" value="<{$data.fieldPrefix}>">
					</div>
				</div>
				<div class="form-group">
					<label for="input-title"  class="col-sm-2 control-label">是否显示</label>
					<div class="col-sm-7"> <{:form_select('IsDisplay',array('1'=>'是','2'=>'否'),$data['IsDisplay'])}> </div>
				</div>
				<div class="form-group">
					<label for="input-title"  class="col-sm-2 control-label">字段数值</label>
					<div class="col-sm-7"> <{:form_select('valueType',dict('FieldvalueType'),$data['valueType'])}></div>
				</div>
				<div class="form-group">
					<label for="input-title" class="col-sm-2 control-label">字段类型</label>
					<div class="col-sm-7"> <{:form_select('displayType',$FieldsdisplayType,$data['displayType'])}> </div>
				</div>
				
				<div class="form-group">
					<label for="input-title" class="col-sm-2 control-label">选项列表</label>
					<div class="col-sm-7"><textarea class="form-control" style="height:80px" name="catItem" placeholder="vaule|displayName,vaule2|displayName2 或使用php|$catItem=dict('name')(数据只支持key=>value)" ><{$data.catItem}></textarea></div>
				</div>
				
					<div class="form-group">
					<label for="input-title" class="col-sm-2 control-label">提示文字</label>
					<div class="col-sm-8">
					<textarea class="form-control" data-type="kindeditor" style="height:80px" name="tip" placeholder="提示操作" ><{$data.tip}></textarea>
					<p>提示文字建议在100以内超过100个字</p>
					</div>
				</div>
				
				<div class="form-group">
					<div class="col-sm-offset-2 col-sm-7">
						<button type="submit" class="btn btn-primary">保存</button>
					</div>
				</div>
			</form>
		</div>
	</div>
</div>
<script>
 
$(function(){
    $(".form-horizontal").bootstrapValidator({
        message: '您填入的值不合法',
        fields:{
            fieldName: {
                message: '字段名',
                validators: {
                    notEmpty: {
                        message: '字段名不能为空'
                    },
                }
            },
			
			/*fieldDisplay: {
                message: '显示名',
                validators: {
                    notEmpty: {
                        message: '显示名不能为空'
                    },
                }
            },
			*/
			displayType: {
                message: '字段类型',
                validators: {
                    notEmpty: {
                        message: '字段类型不能为空'
                    },
                }
            },
			
			valueType: {
                message: '字段数值',
                validators: {
                    notEmpty: {
                        message: '字段数值不能为空'
                    },
                }
            },
			
        }
    });
	
 
});
 </script> 